revision:
The <script> tag is used to embed a client-side script (JavaScript). The <script> element either contains scripting statements, or it points to an external script file through the "src attribute". Common uses for JavaScript are image manipulation, form validation, and dynamic changes of content.
async ; value: async;
specifies that the script is downloaded in parallel to parsing the page, and executed as soon as it is available (before parsing completes) (only for external scripts).
crossorigin ; value: anonymous, use-credentials;
sets the mode of the request to an HTTP CORS Request.
defer ; value: defer;
specifies that the script is downloaded in parallel to parsing the page, and executed after the page has finished parsing (only for external scripts).
integrity ; value: filehash;
allows a browser to check the fetched script to ensure that the code is never loaded if the source has been manipulated.
nomodule ; value: True, False:
specifies that the script should not be executed in browsers supporting ES2015 modules.
referrerpolicy ; value: no-referrer, no-referrer-when-downgrade, origin, origin-when-cross-origin, same-origin, strict-origin, strict-origin-when-cross-origin, unsafe-url;
specifies which referrer information to send when fetching a script.
src ; value: URL;
specifies the URL of an external script file.
type ; value: scripttype;
specifies the media type of the script.
<script> . . . </script>
Codes:
<p class="spec" id="demo"></p> <script> document.getElementById("demo").innerHTML = "Hello JavaScript!"; </script>
Codes:
<span style="margin-left:4vw;" onmouseover="myAlert();"> Bring your mouse here to see an alert </span> <script type="text/javascript"> function myAlert(){ alert("I am an event handler...."); return; } </script>